// StaticTestDiag.cpp : implementation file
//

#include "stdafx.h"
#include "ExperimentScheduler.h"
#include "StaticTestDiag.h"


// CStaticTestDiag dialog

IMPLEMENT_DYNAMIC(CStaticTestDiag, CDialog)

CStaticTestDiag::CStaticTestDiag(CWnd* pParent /*=NULL*/)
	: CDialog(CStaticTestDiag::IDD, pParent)
	, m_strIntruction(_T("Static Test: Peer joins into the overlay evenly at the beginning of the experiment, and leaves evenly at the end of this experiment. All the data is published before second peer joining."))
{

}

CStaticTestDiag::~CStaticTestDiag()
{
}

void CStaticTestDiag::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_strIntruction);
}


BEGIN_MESSAGE_MAP(CStaticTestDiag, CDialog)
	ON_BN_CLICKED(IDC_BUTTON_Open_Configuration, &CStaticTestDiag::OnBnClickedButtonOpenConfiguration)
	ON_BN_CLICKED(IDC_BUTTON_RUN, &CStaticTestDiag::OnBnClickedButtonRun)
	ON_BN_CLICKED(IDC_BUTTON_Open_Folder, &CStaticTestDiag::OnBnClickedButtonOpenFolder)
END_MESSAGE_MAP()


// CStaticTestDiag message handlers

BOOL CStaticTestDiag::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	m_strCurPath.GetBufferSetLength(MAX_PATH+1);
	GetModuleFileName(NULL, m_strCurPath.GetBuffer(), MAX_PATH);
	m_strCurPath.Delete(m_strCurPath.ReverseFind('\\')+1,m_strCurPath.GetLength()-1-m_strCurPath.ReverseFind('\\'));
	m_strCurPath.Append("StaticTest\\");
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CStaticTestDiag::OnBnClickedButtonOpenConfiguration()
{
	// TODO: Add your control notification handler code here
	CString cmd("notepad.exe ");
	cmd.Append( m_strCurPath);
	cmd.Append("parameter\\Parameter.xml");

	WinExec(cmd.GetString(),SW_SHOW);
}

void CStaticTestDiag::OnBnClickedButtonRun()
{
	// TODO: Add your control notification handler code here
	CString cmd( m_strCurPath);
	cmd.Append("MkadPlus.exe");
	WinExec(cmd.GetString(),SW_SHOW);
}

void CStaticTestDiag::OnBnClickedButtonOpenFolder()
{
	// TODO: Add your control notification handler code here
	ShellExecute(NULL , "open", m_strCurPath, NULL, NULL, SW_SHOWNORMAL); 
}
